home *** CD-ROM | disk | FTP | other *** search
/ ShareWare OnLine 2 / ShareWare OnLine Volume 2 (CMS Software)(1993).iso / util2 / vol12n11.zip / OLFONT.ZIP / OLFBLOK.C < prev    next >
C/C++ Source or Header  |  1993-04-02  |  2KB  |  65 lines

  1. /*----------------------------------------
  2.    OLFBLOK.C -- Blocked OS/2 Outline Font
  3.                 (c) Charles Petzold, 1993
  4.   ----------------------------------------*/
  5.  
  6. #define INCL_WIN
  7. #define INCL_GPI
  8. #include <os2.h>
  9. #include <string.h>
  10. #include "olf.h"
  11.  
  12. #define LCID_FONT    1
  13.  
  14. void PaintClient (HPS hps, SHORT cxClient, SHORT cyClient)
  15.      {
  16.      static CHAR szText [] = "Hello!" ;
  17.      int         i ;
  18.      POINTL      ptl, aptlTextBox [TXTBOX_COUNT] ;
  19.  
  20.           // Create and size the logical font
  21.  
  22.      CreateOutlineFont (hps, LCID_FONT, "Times New Roman Italic", 0, 0) ;
  23.      GpiSetCharSet (hps, LCID_FONT) ;
  24.      ScaleOutlineFont (hps, 1440, 1440) ;
  25.  
  26.           // Get the text box
  27.  
  28.      GpiQueryTextBox (hps, strlen (szText), szText,
  29.                       TXTBOX_COUNT, aptlTextBox) ;
  30.  
  31.           // Display the font normally
  32.  
  33.      ptl.x = (cxClient - aptlTextBox [TXTBOX_CONCAT].x) / 2 ;
  34.      ptl.y = (cyClient - aptlTextBox [TXTBOX_TOPLEFT].y
  35.                        - aptlTextBox [TXTBOX_BOTTOMLEFT].y) / 2 ;
  36.  
  37.      for (i = 0 ; i < 16 ; i++)
  38.           {
  39.           GpiCharStringAt (hps, &ptl, strlen (szText), szText) ;
  40.  
  41.           ptl.x -- ;
  42.           ptl.y ++ ;
  43.           }
  44.  
  45.      GpiSetColor (hps, CLR_BACKGROUND) ;
  46.      GpiCharStringAt (hps, &ptl, strlen (szText), szText) ;
  47.  
  48.           // Create the path
  49.  
  50.      GpiBeginPath (hps, 1) ;
  51.      GpiCharStringAt (hps, &ptl, strlen (szText), szText) ;
  52.      GpiEndPath (hps) ;
  53.  
  54.           // Outline the path
  55.  
  56.      GpiSetColor (hps, CLR_NEUTRAL) ;
  57.      GpiSetLineWidth (hps, LINEWIDTH_THICK) ;
  58.      GpiOutlinePath (hps, 1, 0) ;
  59.  
  60.           // Select the default font; delete the logical font
  61.  
  62.      GpiSetCharSet (hps, LCID_DEFAULT) ;
  63.      GpiDeleteSetId (hps, LCID_FONT) ;
  64.      }
  65.